--拳脚相交
local quanjiaoxiangjiao = fk.CreateSkill {
    name = "mcdh_quanjiaoxiangjiao"
}

quanjiaoxiangjiao:addEffect(fk.AfterCardsMove,{
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(self) and player.phase ~= Player.NotActive then
            local ids = {}
            local room = player.room
            for _, move in ipairs(data) do
                if move.toArea == Card.DiscardPile then
                    if move.moveReason ~= fk.ReasonUse then
                        for _, info in ipairs(move.moveInfo) do
                            local card = Fk:getCardById(info.cardId)
                            if card.trueName == "slash" and not table.contains(player:getTableMark("quanjiaoxiangjiao-turn"),card:getColorString()) then
                                return true
                            end
                        end
                    end
                end
            end
        end
    end,
    on_cost = function(self, event, target, player, data)
        return true
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        for _, move in ipairs(data) do
            if move.toArea == Card.DiscardPile then
                if move.moveReason ~= fk.ReasonUse then
                    for _, info in ipairs(move.moveInfo) do
                        local card = Fk:getCardById(info.cardId)
                        if card.trueName == "slash"  and not table.contains(player:getTableMark("quanjiaoxiangjiao-turn"),card:getColorString()) then
                            if card.color == Card.Red then
                                room:addPlayerMark(player,"@quanjiaoxiangjiao_damage-turn",1)
                            else
                                player:drawCards(2,self.name)
                            end
                            local mark = player:getTableMark("quanjiaoxiangjiao-turn")
                            table.insert(mark,card:getColorString())
                            room:setPlayerMark(player,"quanjiaoxiangjiao-turn",mark)
                        end
                    end
                end
            end
        end
    end
})

quanjiaoxiangjiao:addEffect(fk.DamageCaused,{
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
            return target == player and player:getMark("@quanjiaoxiangjiao_damage-turn") ~= 0
    end,
    on_cost = function(self, event, target, player, data)
        return true
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        if event == fk.DamageCaused then
            data.damage = data.damage + player:getMark("@quanjiaoxiangjiao_damage-turn")
            room:setPlayerMark(player,"@quanjiaoxiangjiao_damage-turn",0)
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_quanjiaoxiangjiao"] = "拳斗",
    [":mcdh_quanjiaoxiangjiao"] = "『拳脚相交』<br>你的回合内每项限一次,当有【杀】不因使用而进入弃牌堆后,若此【杀】为:1.红色,本回合你下次造成的伤害+1;2.为黑色,你摸两张牌。",
    ["@quanjiaoxiangjiao_damage-turn"] = "拳脚相交",
}

return quanjiaoxiangjiao